package com.utils;

import com.google.gson.Gson;

/**
 * @author: 晓帆
 * @description:单利懒加载：整个工程只存在一个gson对象，节省内存空间
 * @create: 2021-06-16 11:44
 **/
public class GsonUtils {
    private static  Gson gson;
    private GsonUtils() {
    }
    public static synchronized Gson getGson(){
        if (gson==null){
            synchronized (GsonUtils.class){
                if (gson==null){
                    gson=new Gson();
                }
            }
        }
        return gson;
    }
}
